package com.hwg.emp.service;

import java.util.HashMap;
import java.util.Map;

import com.hwg.emp.service.impl.DeptServiceImpl;
import com.hwg.emp.service.impl.EmployeeServiceImpl;
import com.hwg.emp.service.impl.AskoffServiceImpl;
import com.hwg.emp.service.impl.AttendanceServiceImpl;
import com.hwg.emp.service.impl.ModuleServiceImpl;
import com.hwg.emp.service.impl.OvertimeServiceImpl;
import com.hwg.emp.service.impl.RoleServiceImpl;
import com.hwg.emp.service.impl.UserServiceImpl;

public class ServiceFactroy {

	private static final Map<Class, Object> SERVICES_MAP = new HashMap<Class, Object>();

	static{
		init();
	}
	
	private static void init() {
		SERVICES_MAP.put(UserService.class, new UserServiceImpl());
		SERVICES_MAP.put(RoleService.class, new RoleServiceImpl());
		SERVICES_MAP.put(ModuleService.class, new ModuleServiceImpl());
		SERVICES_MAP.put(EmployeeService.class, new EmployeeServiceImpl());
		SERVICES_MAP.put(DeptService.class, new DeptServiceImpl());
		SERVICES_MAP.put(OvertimeService.class, new OvertimeServiceImpl());
		SERVICES_MAP.put(AskoffService.class, new AskoffServiceImpl());
		SERVICES_MAP.put(AttendanceService.class, new AttendanceServiceImpl());
	}

	public static <T> T getService(Class<T> type) {
		return (T) SERVICES_MAP.get(type);
	}
	
}
